home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0793 / PARK-DSK.PAS < prev    next >
Pascal/Delphi Source File  |  1993-08-01  |  2KB  |  42 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 273 of 279                                                               
  3. From : Jan Doggen                          2:500/131.0          11 Jul 93  20:49 
  4. To   : Mark Stephen                                                              
  5. Subj : park it!                                                               
  6. ────────────────────────────────────────────────────────────────────────────────
  7.  -=> Quoting Mark Stephen to Herb Brown <=-
  8.  
  9.  HB> Anybody have any suggestions, experiences, trials, tribulations,
  10.  HB> videos, and/or code examples on how to park a hard drive?
  11.  
  12.  MS> Trouble is, I have no idea of how to find out if the code has actually
  13.  MS> done what I want it to, and there seems to be a real possibility of
  14.  
  15.  Yep, took me some time to figure out you can't test where the head is
  16.  (i.e. if the park was succesful).
  17.  I always assume that it won't do any harm on self-parking drives
  18.  (they just park twice).
  19.  Here's some code for Herb too; I guess he reads this too. }
  20.  
  21. PROCEDURE ParkDisk;
  22.   VAR Regs: Registers;
  23.   BEGIN
  24.     Regs.AH := $08;                { 'Return drive parameters' function }
  25.     Regs.DL := $80;           { Physical drive number - first hard disk }
  26.     Regs.AL := $00;
  27.     Intr($13,Regs);
  28.     Assert((Regs.Flags AND FCarry) = 0,
  29.       'Error getting disk parameters - AL returns '+IntToStr(Regs.AL,0));
  30.     { Now: DL = Number of drives responding                             }
  31.     {      DH = Maximum head number (# heads - 1)                       }
  32.     {      CH = Maximum cylinders/tracks (# tracks - 1) - lower 8 bits  }
  33.     {      CL = Higher 2 bits: high 2 bits of max cyl/tr                }
  34.     {           Lower 6 bits: Maximum sector number                     }
  35.     { We now position the heads using the BIOS Seek service. We can use }
  36.     { the returned registers again if we set DL back to $80.            }
  37.     Regs.AH := $0C;
  38.     Regs.DL := $80;
  39.     Intr($13,Regs);
  40.     Assert((Regs.Flags AND FCarry) = 0,
  41.       'Error parking disk - AL returns '+IntToStr(Regs.AL,0));
  42.   END; { ParkDisk }